/**
 * Created by zhaoyoucai on 16/11/29.
 */
    $('#showSide').click(function(){
        $("#aside").toggleClass("folded");
        //$(".app-header .navbar, .app-content").toggleClass("container");
        $(".app-header .navbar").toggleClass("container");
    })


    $(document).ready(function(){
        $(document).on('click','#action-toggle',function(){
            if(this.checked){
                $("input[name='post[]']").each(function(){
                    this.checked = true;
                });
            }else{
                $("input[name='post[]']").each(function(){
                    this.checked = false;
                });
            }
        });


    });

    $('.editCompany').click(function(){
        var obj = $(this).parent().parent();
        $('#companyID').val($(this).attr('data-val'));
        $('#editCompanyName').val(obj.children('td').eq(1).children('a').html());
        $('#editManager').val(obj.children('td').eq(2).html());
        $('#editContent').val(obj.children('td').eq(3).html());


        //console.log(obj.children('td').eq(1).html());

    });

    $('.deleteCompany').click(function(){
        console.log($(this).attr('data-val'));
        $('#deleteCompanyID').val($(this).attr('data-val'));
        $('#deleteCompanyName').html($(this).parent().parent().children('td').eq(1).children('a').html());

    });

    $('.addStore').click(function(){
        $('#addStoreCompanyID').val($(this).attr('data-val'));
        var obj = $(this).parent().parent();
        $('#storeCompanyName').val(obj.children('td').eq(1).children('a').html());

    });


    function checkform(obj){
        var name = $('#addCompanyName').val();
        var manager = $('#addManager').val();
        console.log(manager);
        if(name.length<=0){
            alert("公司名称不能为空！");
            $('#addCompanyName').focus();
            return false;
        }
        if(manager=='null' ||manager=='0'){
            alert("请选择负责人！");
            return false;
        }
    }